server.get(ꞌꞌ/loggerꞌꞌ)   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
'use strict'
2
3
const restify = require('restify')
4
const winston = require('winston')
5
const winstonRestify = require('..')
6
7
winston
8
  // HTTP transport included to winston
9
  .add(
10
    winstonRestify, {
11
      dispatch: true,
12
      client: {
13
        url: 'http://localhost:8080'
14
      }
15
    }
16
  )
17
  // remove transport from the logger to terminal
18
  .remove(winston.transports.Console)
19
20
const server = restify.createServer()
21
22
server.get('/', function (req, res, next) {
23
  winston.info('sending_logger', {
24
    method: 'get',
25
    path: '/logger'
26
  })
27
  res.send(200, { info: 'see your terminal!!' })
28
  next()
29
})
30
31
server.get('/logger', function (req, res, next) {
32
  console.log('hello logger!!!!')
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
33
  next()
34
})
35
36
server.listen(8080, function () {
37
  console.log('listening on http://localhost:8080/')
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
38
})
39